"""
@author: peng
@email: sb.peng@hzgosun.com
@file: gridManage.py
@time: 2019/5/27 17:44

"""
from common.poium.poium import Page
from common.vue.button import VueButton
from common.vue.element import VueElements
from common.vue.float_window import FloatWindow
from common.vue.label import ElementType as ET, ElementBaseLabel
from common.vue.region import VueRegion
from common.vue.search import VueSearch
from common.vue.table import VueTable, VueTurnPage
from common.vue.tree import VueTree

class SearchTools(VueSearch):
    '''网格管理'''
    keyword_dropdown_list = ElementBaseLabel(ET.DROPDOWN_LIST,label="关键字")
    keyword_input = ElementBaseLabel(ET.INPUT,label="关键字")

    grid_dropdown_list = ElementBaseLabel(ET.DROPDOWN_LIST,label="网格编码")
    gridname_dropdown_list = ElementBaseLabel(ET.DROPDOWN_LIST,label="网格名称")

    grid_region = ElementBaseLabel(ET.REGION,label="区域")
    grid_region_selector = VueRegion(index=0)

    search_btn = VueButton("检索")

    def __init__(self):
        super(SearchTools,self).__init__()

class Table(VueTable):
    '''添加网格'''

    add_btn = VueButton("添加")

    def __init__(self):
        super(Table,self).__init__()

class AddGridWindow(FloatWindow):
    """添加网格信息"""
    base_info = VueElements(class_name='ivu-collapse-header', label="添加网格")

    grid_name = ElementBaseLabel(ET.INPUT,label="网格名称")
    grid_code = ElementBaseLabel(ET.INPUT,label="网格编码")
    leader_code = ElementBaseLabel(ET.INPUT,label="上级编码")

    grid_region= ElementBaseLabel(ET.REGION,label="区域")
    grid_region_selector = VueRegion(index=1)
    add_grid_btn = VueButton("添加")
    """网格长界面"""
    grid_info = VueElements(class_name='ivu-collapse-header', index=1)
    # base_info_1_selector=
    gridMemberName = ElementBaseLabel(ET.INPUT,label="姓名")
    gridMemberPhone = ElementBaseLabel(ET.INPUT,label="手机号码")

    """网格员界面"""
    gridNumber_info = VueElements(class_name='ivu-collapse-header', index=2)

    def __init__(self, title=None, index=None):
        super(AddGridWindow, self).__init__(title=title, index=index)

class ModiyGridWindow(AddGridWindow):
    """修改网格信息弹窗"""
    grid_region_dropdown_list = ElementBaseLabel(ET.DROPDOWN_LIST, label="区域")
    grid_region_input = ElementBaseLabel(ET.REGION, label="区域")  # 区域后面的区域请选择框

    def __init__(self, title=None, index=None):
        super(ModiyGridWindow, self).__init__(title=title, index=index)



class gridPage(Page):
    '''网格管理界面'''
    searchTools = SearchTools()    #查询区域
    table = Table()   #列表
    addGrid = AddGridWindow(index=1)
    turnPage = VueTurnPage()    #翻页
    modifyGrid = ModiyGridWindow(index=1)



